package com.stu.controller.admin;

import com.stu.Dto.JobInformationDTO;
import com.stu.result.Result;
import com.stu.serive.JobInformationService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Slf4j
@RestController("userJobInformationController")
@RequestMapping("/admin")
public class JobInformationController {

    @Autowired
    private JobInformationService jobInformationService;

    /**
     * 批量添加工作信息
     * @return
     */
    @PostMapping("/jobInformation")
    private Result insertJobInformation(@RequestBody JobInformationDTO jobInformationDTOList){
        //log.info("批量添加工作信息jobInformationDTOList:{}",jobInformationDTOList);
        jobInformationService.insertJobInformation(jobInformationDTOList);
        return Result.success();
    }

    /**
     * 修改工作信息
     * @param jobInformationDTO
     * @return
     */
    @PutMapping("/jobInformation")
    private Result updateJobInformation(@RequestBody JobInformationDTO jobInformationDTO){
        jobInformationService.updateJobInformation(jobInformationDTO);
        return Result.success();
    }

    /**
     * 删除工作信息
     * @param ids
     * @return
     */
    @DeleteMapping("/jobInformation")
    private Result deleteJobInformation(@RequestParam List<Integer> ids){
        jobInformationService.deleteJobInformation(ids);
        jobInformationService.deleteJobInformation(ids);
        return Result.success();
    }
}
